﻿using System;
namespace Kis.Xroad.Eu {
    
    
    [System.SerializableAttribute()]
    public class DerivedSimple : global::Kis.Xroad.Eu.Simple {
        
        public const int AINULTNR = 5;
        
        public DerivedSimple(int value) : 
                base(value) {
            this.Pattern = @"(5)";
            this.Validate();
            string annot = null;
            if (Value == 5) {
                annot = "Ainult nr";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public DerivedSimple(string value) : 
                base(value) {
            this.Pattern = @"(5)";
            this.Validate();
            string annot = null;
            if (Value == 5) {
                annot = "Ainult nr";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public DerivedSimple() : 
                base(new int()) {
        }
        
        public static bool TryParse(string value, out global::Kis.Xroad.Eu.DerivedSimple result) {
            try {
                result = new global::Kis.Xroad.Eu.DerivedSimple(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator Int32 (DerivedSimple value) {
            return value.Value;
        }
        
        public static implicit operator DerivedSimple (int value) {
            return new DerivedSimple(value);
        }
    }
}
